import java.util.HashMap;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/3/16 10:31
 */
public class MapDemo {
    public static void main(String[] args) {
        final HashMap<String, Integer> map1 = new HashMap<>();
    
        map1.put("a", 1);
        map1.put("aa", 1);
        map1.put("ab", 1);
        map1.put("aaa", 1);
        
        map1.entrySet().removeIf(entry -> entry.getKey().length() == 2);
    
        System.out.println(map1);
    }
}
